Number Systems
Part 1. Introduction
What
is a Number System?
A number system is a
system of representing numbers using a set of symbols. Each symbol, or digit,
has a specific value, and the combination of digits determines the overall value
of the number.
Part 2. Decimal Number System
We use decimal numbers in
day to day life. This is the first number system we learn way back to our grade
school. They are based on the number 10. They are represented by
0,1,2,3,4,5,6,7,8 and 9.
Decimal
number representation.
Back in elementary
school, we learned about place value. We understood that numbers are made up of
digits, and each digit has a specific value based on its position.
Example
No. 1
For Example, the Number 1995.
We represent this number as:
Position |
Digit |
Multiplier |
|
Ones |
5 |
x 100 |
5 |
Tens |
9 |
x 101 |
90 |
Hundreds |
9 |
x 102 |
900 |
Thousands |
1 |
x 103 |
1000 |
After adding all the numbers, we get 1995.
Example
No. 2
For Example, the Number 3.141.
We represent this number as:
Position |
Digit |
Multiplier |
|
Thousandths |
1 |
x 10-3 |
.001 |
Hundredths |
4 |
x 10-2 |
.04 |
Tenths |
1 |
x 10-1 |
.1 |
Ones |
3 |
x 100 |
3 |
After adding all the numbers, we get 3.141.
Part 3. Binary Number System
Binary numbers, the foundation
of computer systems, use only two digits: 0 and 1. This simple system allows
computers to process information efficiently.
Note: Binary numbers, denoted by the subscript 2.
Binary
number representation.
Unlike decimal numbers that use 10 as base, binary numbers use 2 as base.
Example
No. 3
For Example, the Number 111000112
We represent this binary number as:
Index |
Digit |
Multiplier |
|
0 |
1 |
x 20 |
1 |
1 |
1 |
x 21 |
2 |
2 |
0 |
x 22 |
0 |
3 |
0 |
x 23 |
0 |
4 |
0 |
x 24 |
0 |
5 |
1 |
x 25 |
32 |
6 |
1 |
x 26 |
64 |
7 |
1 |
x 27 |
128 |
By adding the numbers, we get 99.
Example
No. 4
For Example, the Number 111111112
We represent this binary number as:
Index |
Digit |
Multiplier |
|
0 |
1 |
x 20 |
1 |
1 |
1 |
x 21 |
2 |
2 |
1 |
x 22 |
4 |
3 |
1 |
x 23 |
8 |
4 |
1 |
x 24 |
16 |
5 |
1 |
x 25 |
32 |
6 |
1 |
x 26 |
64 |
7 |
1 |
x 27 |
128 |
By adding the numbers, we get 255.
Example
No. 5
For Example, the Number 1111.11112
We represent this binary number as:
Index |
Digit |
Multiplier |
|
-4 |
1 |
x 2-4 |
0.0625 |
-3 |
1 |
x 2-3 |
0.125 |
-2 |
1 |
x 2-2 |
0.25 |
-1 |
1 |
x 2-1 |
.5 |
0 |
1 |
x 20 |
1 |
1 |
1 |
x 21 |
32 |
2 |
1 |
x 22 |
64 |
3 |
1 |
x 23 |
128 |
By adding the numbers, we get 15.9375.
Part 4. Octal Number System
Octal numbers are a
number system based on eight digits: 0, 1, 2, 3, 4, 5, 6, and 7. They are often
used in computer science and digital electronics as a more compact representation
of binary numbers.
Note: Octal numbers, denoted by the subscript 8.
Octal
number representation.
Octal numbers use the
base 8.
Example
No. 6
For Example, the number 15678
We represent this octal number as:
Index |
Digit |
Multiplier |
|
0 |
7 |
x 80 |
7 |
1 |
6 |
x 81 |
48 |
2 |
5 |
x 82 |
320 |
3 |
1 |
x 83 |
512 |
By adding the numbers, we get 887.
Part 5. Hexadecimal Number System
This number is more compact if compared to binary and octal
numbers. Its use 0,1,2,3,4,5,6,7,8,9, A, B, C, D, E and F.
Note: Hexadecimal numbers,
denoted by the subscript 16.
Hexadecimal
Number Representation.
Hexadecimal number used the base 16.
Example
No. 7
For Example, the number 15AC16
We represent this Hexadecimal number as:
Index |
Digit |
Multiplier |
|
0 |
C = 12 |
x 160 |
12 |
1 |
A = 10 |
x 161 |
160 |
2 |
5 |
x 162 |
1280 |
3 |
1 |
x 163 |
4096 |
By adding the numbers, we get 5548.
Trivia!!!
The binary system was used in early computers like the ENIAC
(Electronic Numerical Integrator and Computer) in the 1940s. These computers used
vacuum tubes to represent 0s and 1s.
Part 6. Conversion from Decimal to Binary Numbers
There are two methods for converting DEC to BIN: The Direct
Method and Successive Division.
Part 6.1. Direct Method
This is the step by step procedure using a direct method.
Step
1: Repeatedly subtract the largest power of 2 that is less than
or equal to the decimal number.
Step
2: Continue this process until the remainder is zero. Note: A
negative remainder is not allowed.
Step
3: For each power of 2 subtracted, write a '1'.
Step
4: List the '1's and '0's in the order in which the subtractions
were performed, starting with the highest power of 2 and proceeding to the
lowest."
Example
No. 7
Convert 55 to BIN:
Hint:
The largest power of 2 we can use is 25 = 32.
Minuend |
Subtrahend |
Difference |
Binary Equivalent |
55 |
32 |
23 |
1 |
23 |
16 |
7 |
1 |
7 |
8 |
-1 |
0 |
7 |
4 |
3 |
1 |
3 |
2 |
1 |
1 |
1 |
1 |
0 |
1 |
Read it from top to bottom, the answer is 1101112
Example
No. 8
Convert 78 to BIN:
Hint:
The largest power of 2 we can use is 26 = 64.
Minuend |
Subtrahend |
Difference |
Binary Equivalent |
78 |
64 |
14 |
1 |
14 |
32 |
-18 |
0 |
14 |
16 |
-2 |
0 |
14 |
8 |
6 |
1 |
6 |
4 |
2 |
1 |
2 |
2 |
0 |
1 |
0 |
1 |
-1 |
0 |
Read it from top to bottom, the answer is 1001102
Example
No. 9
Convert 345 to BIN:
Hint:
The largest power of 2 we can use is 28 = 256.
Minuend |
Subtrahend |
Difference |
Binary Equivalent |
345 |
256 |
89 |
1 |
89 |
128 |
-39 |
0 |
89 |
64 |
25 |
1 |
25 |
32 |
-7 |
0 |
25 |
16 |
9 |
1 |
9 |
8 |
1 |
1 |
1 |
4 |
-3 |
0 |
1 |
2 |
-1 |
0 |
1 |
1 |
0 |
1 |
Read it from top to bottom, the answer is 10101100112
Part 6.2. Successive
Division Method
This is the step by step
procedure using a Successive Division method.
Step
1: Successively divide the decimal number by 2.
Step
2: Place the resulting quotient directly below the dividend.
Step
3: Place the remainder opposite the quotient for clarity.
Step
4: Repeat steps 1-3 until the quotient is less than 2.
Step
5: The equivalent binary number is formed by reading the
remainders from bottom to top. The first remainder is the least significant bit
(LSB), while the last remainder is the most significant bit (MSB).
Example
No. 10
Convert 55 to BIN:
Dividend |
Divisor |
Quotient |
Remainder |
55 |
2 |
27 |
1 |
27 |
2 |
13 |
1 |
13 |
2 |
6 |
1 |
6 |
2 |
3 |
0 |
3 |
2 |
1 |
1 |
1 |
2 |
0 |
1 |
Read it from bottom to top, the answer is 1101112.
Example
No. 11
Convert 78 to BIN:
Dividend |
Divisor |
Quotient |
Remainder |
78 |
2 |
39 |
0 |
39 |
2 |
19 |
1 |
19 |
2 |
9 |
1 |
9 |
2 |
4 |
1 |
4 |
2 |
2 |
0 |
2 |
2 |
1 |
0 |
1 |
2 |
0 |
1 |
Read it from bottom to top, the answer is 10011102.
Example
No. 12
Convert 345 to BIN:
Dividend |
Divisor |
Quotient |
Remainder |
345 |
2 |
172 |
1 |
172 |
2 |
86 |
0 |
86 |
2 |
43 |
0 |
43 |
2 |
21 |
1 |
21 |
2 |
10 |
1 |
10 |
2 |
5 |
0 |
5 |
2 |
2 |
1 |
2 |
2 |
1 |
0 |
1 |
2 |
0 |
1 |
Read it from bottom to top, the answer is 1010110012
Part 7. Conversion from Binary to Octal Numbers
To convert a binary number to octal, we must group the binary digits into groups of three, starting from the right. Then, convert each group into its equivalent decimal number.
Example
No. 13
Convert 1000110101010102 to OCT
Solution:
Group the number into group of three
100 011 010 101 010
|
5th 3 bit |
4th 3 bit |
3rd 3 bit |
2nd 3 bit |
1st 3 bit |
|
100 |
011 |
010 |
101 |
010 |
3 bit binary string to
Decimal |
4 |
3 |
2 |
5 |
2 |
Read it from left to right, the answer is: 432528
Example
No. 14
Convert 111010101011110101012 to OCT
Solution:
Group the number into group of three
011 101 010 101 111 010 101
|
7th 3bit |
6th 3bit |
5th 3bit |
4th 3bit |
3rd 3bit |
2nd 3bit |
1st 3bit |
|
011 |
101 |
010 |
101 |
111 |
010 |
101 |
3 bit binary string to
Decimal |
3 |
5 |
2 |
5 |
7 |
2 |
5 |
Read it from left to right, the answer is: 35257258
Example
No. 15
Convert 111111111111111111111112 to OCT
Solution:
Group the number into group of three
011 111 111 111 111 111 111 111
|
8th 3bit |
7th 3bit |
6th 3bit |
5th 3bit |
4th 3bit |
3rd 3bit |
2nd 3bit |
1st 3bit |
|
011 |
111 |
111 |
111 |
111 |
111 |
111 |
111 |
3 bit binary string to
Decimal |
3 |
7 |
7 |
7 |
7 |
7 |
7 |
7 |
Read it from left to right, the answer is: 37777778
Part 8. Conversion from Octal to Binary Numbers
Converting octal to binary is the reverse process of converting binary to octal. To convert octal to binary, first convert each octal digit to its equivalent 3-bit binary representation, then concatenate the resulting binary strings.
Example
No. 16
Convert 432528 to BIN
|
5th digit |
4th digit |
3rd digit |
2nd digit |
1st digit |
|
4 |
3 |
2 |
5 |
2 |
Decimal to 3bit Binary
String |
100 |
011 |
010 |
101 |
010 |
Read it from left to right, the answer is: 1000110101010102
Example
No. 17
Convert 35257258 to
BIN
|
7th digit |
6th digit |
5th digit |
4th digit |
3rd digit |
2nd digit |
1st digit |
|
3 |
5 |
2 |
5 |
7 |
2 |
5 |
Decimal to 3bit Binary
String |
011 |
101 |
010 |
101 |
111 |
010 |
101 |
Read it from left to right, the answer is:
111010101011110101012
Example
No. 18
Convert 37777778 to
BIN
|
7th digit |
6th digit |
5th digit |
4th digit |
3rd digit |
2nd digit |
1st digit |
|
3 |
7 |
7 |
7 |
7 |
7 |
7 |
Decimal to 3bit Binary
String |
011 |
111 |
111 |
111 |
111 |
111 |
111 |
Read it from left to right, the answer is: 111111111111111111111112
Part 9. Conversion from Binary to Hexadecimal Numbers
To convert a binary number to octal, we must group the binary
digits into groups of four, starting from the right. Then, convert each group
into its equivalent decimal number.
Example
No. 19
Convert 11101010001010101010100012 to Hexadecimal
Group the number into group of three
0001 1101 0100 0101 0101 0101 0001
|
7th 4 string bit |
6th 4 string bit |
5th 4 string bit |
4th 4 string bit |
3rd 4 string bit |
2nd 4 string bit |
1st 4 string bit |
|
0001 |
1101 |
0100 |
0101 |
0101 |
0101 |
0001 |
4 bit binary string to Decimal |
1 |
D |
4 |
5 |
5 |
5 |
1 |
Read it from left to right, the answer is: 1D4555116
Example
No. 20
Convert 11101111000111000111110001111000111112 to
Hexadecimal
Group the number into group of three
1111 0001 1111 1000 1111 1000 0011 1110 1101 0001
|
7th 4 string bit |
7th 4 string bit |
7th 4 string bit |
7th 4 string bit |
6th 4 string bit |
5th 4 string bit |
4th 4 string bit |
3rd 4 string bit |
2nd 4 string bit |
1st 4 string bit |
|
1111 |
0001 |
1111 |
1000 |
1111 |
1000 |
0011 |
1110 |
1101 |
0001 |
4 bit binary string to Decimal |
F |
1 |
F |
8 |
F |
8 |
3 |
E |
D |
1 |
Read it from left to right, the answer is: 1DE38F8F1F16
Part 9. Conversion from Hexadecimal to Binary Numbers
Converting hex to binary is the reverse process of converting binary to hex. To convert hex to binary, first convert each hex digit to its equivalent 4-bit binary representation, then concatenate the resulting binary strings.
Example
No. 21
Convert 1D4555116 to Binary
|
|
|
7th digit |
6th digit |
5th digit |
4th digit |
3rd digit |
2nd digit |
1st digit |
|
|
|
1 |
D |
4 |
5 |
5 |
5 |
1 |
Decimal to 4bit Binary
String |
|
|
0001 |
1101 |
0100 |
0101 |
0101 |
0101 |
0001 |
Read it from left to right, the answer is: 00011101010001010101010100012
Example
No. 22
Convert 1628DDF16 to Binary
|
|
|
7th digit |
6th digit |
5th digit |
4th digit |
3rd digit |
2nd digit |
1st digit |
|
|
|
1 |
6 |
2 |
8 |
D |
D |
F |
Decimal to 4bit Binary
String |
|
|
0001 |
0110 |
0010 |
1000 |
1101 |
1101 |
1111 |
Read it from left to right, the answer is: 00010110001010001101110111112
Part 10. Conversion from Decimal to Octal Numbers
Step
1: Successively divide the decimal number by 8.
Step
2: Place the resulting quotient directly below the dividend.
Step
3: Place the remainder opposite the quotient for clarity.
Step
4: Repeat steps 1-3 until the quotient is less than 2.
Step 5: The equivalent octal number is formed by reading the remainders from bottom to top. The first remainder is the least significant bit (LSB), while the last remainder is the most significant bit (MSB).
Example
No. 23
Convert 456 to Octal number:
Dividend |
Divisor |
Quotient |
Remainder |
456 |
8 |
57 |
0 |
57 |
8 |
7 |
1 |
7 |
8 |
0 |
7 |
Let’s read it from bottom to top, the answer is: 7108
Example
No. 24
Convert 1453 to Octal number:
Dividend |
Divisor |
Quotient |
Remainder |
1453 |
8 |
181 |
5 |
181 |
8 |
22 |
5 |
22 |
8 |
2 |
6 |
2 |
8 |
0 |
2 |
Let’s read it from bottom to top, the answer is: 26558
Example
No. 25
Convert 8595 to Octal number:
Dividend |
Divisor |
Quotient |
Remainder |
8595 |
8 |
1074 |
3 |
1074 |
8 |
134 |
2 |
134 |
8 |
16 |
6 |
16 |
8 |
2 |
0 |
2 |
8 |
0 |
2 |
Let’s read it from bottom to top, the answer is: 206238
Part 11. Conversion from Decimal to Hexadecimal Numbers
Step
1: Successively divide the decimal number by 16.
Step
2: Place the resulting quotient directly below the dividend.
Step
3: Place the remainder opposite the quotient for clarity.
Step
4: Repeat steps 1-3 until the quotient is less than 2.
Step
5: The equivalent oct number is formed
by reading the remainders from bottom to top. The first remainder is the least
significant bit (LSB), while the last remainder is the most significant bit
(MSB).
Example
No. 26
Convert 456 to Hexadecimal number:
Dividend |
Divisor |
Quotient |
Remainder |
456 |
16 |
28 |
8 |
28 |
16 |
1 |
C |
1 |
16 |
0 |
1 |
Let’s read it from bottom to top, the answer is: 1C816
Example
No. 27
Convert 75839 to Hexadecimal number:
Dividend |
Divisor |
Quotient |
Remainder |
75839 |
16 |
4739 |
F |
4739 |
16 |
296 |
3 |
296 |
16 |
18 |
8 |
18 |
16 |
1 |
2 |
1 |
16 |
0 |
1 |
Let’s read it from bottom to top, the answer is: 1283F16
Fun
Fact!!! Octal was once more common in computing due to the early use
of 6-bit character codes, which could be easily grouped into 3-bit octal digits.
However, hexadecimal has become the preferred choice in modern computing due to
its wider use in various data formats and programming languages.
Click
Here for Activity No 1!!!
Part 12. Addition and Subtraction of Binary Numbers
Part 12.1 Addition of
Binary Numbers
To add binary numbers, we must understand how to add single
binary bits.
Basic Rules of Addition
0 + 0 = 1
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0 plus a carry-over 1
Carry-over operations in binary addition are analogous to those
in decimal arithmetic. Given that 1 is the maximum digit in the binary system,
any sum exceeding 1 necessitates a carry-over.
Example
No. 28
Add 11110101 to 11101011
Solution:
|
9th Bit |
8th Bit |
7th Bit |
6th Bit |
5th Bit |
4th Bit |
3rd Bit |
2nd Bit |
1st Bit |
Carry Over |
|
1 |
1 |
1 |
1 |
1 |
1 |
1 |
|
Augend |
|
1 |
1 |
1 |
1 |
0 |
1 |
0 |
1 |
Addend |
|
1 |
1 |
1 |
0 |
1 |
0 |
1 |
1 |
Sum |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
Let’s read it from left to right, the answer is:
111100002
Example
No. 29
Add 11101010101110 to 1110011001011
Solution:
|
15th Bit |
14th Bit |
13th Bit |
12th Bit |
11th Bit |
10th Bit |
9th Bit |
8th Bit |
7th Bit |
6th Bit |
5th Bit |
4th Bit |
3rd Bit |
2nd Bit |
1st Bit |
Carry Over |
1 |
1 |
1 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
|
Augend |
|
1 |
1 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
0 |
Addend |
|
|
1 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
1 |
Sum |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
1 |
Let’s read it from left to right, the answer is:
1010111011110012
Part 12.2 Subtraction of
Binary Numbers
To subtract binary
numbers, we must understand how to subtract single binary bits.
Basic Rules of Subtraction
0 - 0 = 0
0 - 1 = 1 with a borrow of 1
1 - 0 = 1
1 - 1 = 0
Example
No. 30
Subtract 1000 from 1011
Solution:
|
5th Bit |
4th Bit |
3rd Bit |
2nd Bit |
1st Bit |
Borrow |
|
|
|
|
|
Minuend |
|
1 |
0 |
1 |
1 |
Subtrahend |
|
1 |
0 |
0 |
0 |
Difference |
|
0 |
0 |
1 |
1 |
Let’s read it from left to right, the answer is: 00112
Example
No. 31
Subtract 101110 from 11100101
Solution:
|
8th Bit |
7th Bit |
6th Bit |
5th Bit |
4th Bit |
3rd Bit |
2nd Bit |
1st Bit |
Borrow |
|
0 |
0 |
1 |
1 |
0 |
|
|
Minuend |
1 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
Subtrahend |
0 |
0 |
1 |
0 |
1 |
1 |
1 |
0 |
Difference |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
1 |
Let’s read it from left to right, the answer is:
101101112
Part 13. Multiplication and Division of Binary Numbers
Part 13.1 Multiplication
of Binary Numbers
To multiply binary numbers, we must understand how to multiply
single binary bits.
Basic Rules of Multiplication
0 x 0 = 0
0 x 1 = 0
1 x 0 = 0
1 x 1 = 1
Example
No. 32
Multiply 11001 by 101
Solution:
|
8th Bit |
7th Bit |
6th Bit |
5th Bit |
4th Bit |
3rd Bit |
2nd Bit |
1st Bit |
Multiplicand |
|
|
|
1 |
1 |
0 |
0 |
1 |
Multiplicator |
|
|
|
|
|
1 |
0 |
1 |
|
|
|
|
1 |
1 |
0 |
0 |
1 |
|
|
|
0 |
0 |
0 |
0 |
0 |
|
|
|
1 |
1 |
0 |
0 |
1 |
|
|
Summation |
|
1 |
1 |
1 |
1 |
1 |
0 |
1 |
Let’s read it from left to right, the answer is: 11111012
Part 13.1 Division of
Binary Numbers
To divide binary numbers, we must understand how to divide
single binary bits.
0 / 1 = 0
1 / 1 = 1
Example
No. 33
Divide 11011001 by 1011
Solution:
Click
Here for Activity No 2!!!
Part 14. Representation of Negative Numbers
There are two common methods for representing negative numbers
using binary digits: signed-magnitude and complement number systems. These
methods are widely used in computer systems.
Part 14.1 Signed-magnitude System
In binary numbers, an extra bit is used to indicate the sign,
often referred to as the sign bit. This sign bit is typically located at the
most significant bit (MSB) position, where 1 represents a positive value and 0
represents a negative value. The remaining bits hold the magnitude of the
number.
For Examples
010101012 = -85
110101012 = 85
011111112 = -127
111111112 = 127
Part 14.2 Complement Number System
There are two types of complements used in number systems:
radix complement and radix minus one complement.
Part 14.2.1 Diminished Radix Complement or Radix-Minus-One
Complement or (r-1)’s Complement System
Radix minus one
complement, also known as (r − 1)'s complement, is a method of
representing negative numbers in a positional numeral system. In this system,
to find the negative representation of a number, each digit is subtracted from
the radix (base) minus one and then the entire result is complemented (all 0s
changed to 1s and vice versa).
For example, in the decimal system (radix 10), the 9's
complement of 25 is 74.
Solution:
9 – 2
= 7
9 – 5
= 4
Let’s read it from top to bottom, the answer is 74.
In binary (radix
2), the 1's complement of 1011 is 0100.
1 – 1
= 0
1 – 0
= 1
1 – 1
= 0
1 – 1
= 0
Let’s read it from top to bottom, the answer is 0100.
Radix minus one
complements are used in some older computer architectures and are still
relevant in certain applications like checksum calculations and error
detection. However, they have largely been replaced by two's complement
representation, which is more efficient and widely used in modern computers.
Part 14.2.2 Radix Complement or True Complement System
Radix complement, also
known as r's complement, is a method of representing negative numbers in a
positional numeral system. In this system, to find the negative representation
of a number, the entire number is subtracted from the radix (base) raised to
the power of the number of digits.
For example, in the decimal system (radix 10), the 10's
complement of 25 is 75.
Solution:
The radix-minus-one complement of 25 is 74. Add one in 74 = 75.
In binary (radix
2), the 2's complement of 1011 is 0101.
Solution:
The radix-minus-one of 1011 is 0100. Then add one to the 0100,
the answer is 0101.
Part 14.3 Subtraction using Complement Number System
Part 14.3.1 Using Radix-minus-one Complement
Procedure:
Step
1. Copy the minuend.
Step
2. Obtain the radix-minus-one complement of the subtrahend.
Step
3. Add the radix-minus-one complemented subtrahend to the
minuend.
Step
4. Handle carry-over: a. If the outmost carry-over from step 3
is '1', add this to the least significant digit obtained in step 3. b. If the
outmost carry-over from step 3 is '0', take the radix-minus-one complement of
the result in step 3 and prefix the negative sign.
Example
No. 34
Subtract 17 from 92
Solution.
Step 1. Copy the minuend.
92
Step
2. Obtain the radix-minus-one complement of the subtrahend.
9 – 1 = 8
9 – 7 = 2
Let’s read it from top to bottom: 82
Step
3. Add the radix-minus-one complemented subtrahend to the
minuend.
92
+ 82 = 174
Step
4. Handle carry-over: a. If the outmost carry-over from step 3 is '1', add this to the least
significant digit obtained in step 3. b. If the outmost carry-over from
step 3 is '0', take the radix-minus-one complement of the result in step 3 and
prefix the negative sign.
74 + 1 = 75 This is
the Answer.
Example
No. 35
Subtract 111 from 110010
Solution.
Step 1. Copy the minuend.
110010
Step
2. Obtain the radix-minus-one complement of the subtrahend.
1 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
The Radix-minus-one of 000111 is 111000
Step
3. Add the radix-minus-one complemented subtrahend to the
minuend.
110010
+ 111000 = 1101010
Step
4. Handle carry-over: a. If the outmost carry-over from step 3 is '1', add this to
the least significant digit obtained in step 3. b. If the outmost
carry-over from step 3 is '0', take the radix-minus-one complement of the
result in step 3 and prefix the negative sign.
Add 1 to 101010 =
1010112 this is our answer.
Example
No. 36
Subtract 110010 from 000111
Solution:
Step 1. Copy the minuend.
000111
Step
2. Obtain the radix-minus-one complement of the subtrahend.
The radix-minus-one complement of subtrahend is 001101
Step
3. Add the radix-minus-one complemented subtrahend to the
minuend.
Add 000111 and 001101, the answer is 010100.
Step
4. Handle carry-over: a. If the outmost carry-over from step 3
is '1', add this to the least significant digit obtained in step 3. b. If the outmost carry-over
from step 3 is '0', take the radix-minus-one complement of the result in step 3
and prefix the negative sign.
The radix-minus-one complement of 010100 is 101011 and add negative sign.
Our answer is -101011.
Part 14.3.2 Using Radix Complement
Procedure:
Step
1. Copy the minuend.
Step
2. Obtain the true complement of the subtrahend.
Step
3. Add the true complemented subtrahend to the minuend.
Step
4. Handle carry-over: a. If the outmost carry-over from step 3
is '1', discard it. b. If the outmost carry-over from step 3 is '0', take the
true complement of the result in step 3 and prefix the negative sign.
Step
5. The obtained result in step 4 is the difference between the
two numbers.
Example
No. 37
Subtract 17 from 92
Solution:
Step
1. Copy the minuend.
92
Step
2. Obtain the true complement of the subtrahend.
Let’s get first the radix-minus-one complement of 17
9 – 1 = 8
9 – 7 = 2
The radix-minus-one complement of 17 is 82, then add one.
Therefore, the true compliment of 17 is 83.
Step
3. Add the true complemented subtrahend to the minuend.
Add 83 and 92, the sum is 175.
Step
4. Handle carry-over: a. If the outmost carry-over from step 3 is '1', discard it. b.
If the outmost carry-over from step 3 is '0', take the true complement of the
result in step 3 and prefix the negative sign
Our answer is 75.
Example
No. 38
Subtract 111 from 110010
Solution:
Step
1. Copy the minuend.
110010
Step
2. Obtain the true complement of the subtrahend.
The radix-minus-one complement of 000111 is 111000.
Therefore, the true compliment of 000111 is 111000 + 1 = 111001.
Step
3. Add the true complemented subtrahend to the minuend.
Add 110010 and 111001, the sum is 1101011.
Step
4. Handle carry-over: a. If the outmost carry-over from step 3 is '1', discard it. b.
If the outmost carry-over from step 3 is '0', take the true complement of the
result in step 3 and prefix the negative sign
Our answer is 1010112.
Example
No. 39
Subtract 110010 from 000111
Solution:
Step
1. Copy the minuend.
000111
Step
2. Obtain the true complement of the subtrahend.
The radix-minus-one complement of 110010 is 001101.
Therefore, the true compliment of 110010 is 001101 + 1 = 001110.
Step
3. Add the true complemented subtrahend to the minuend.
Add 000111 and 001110, the sum is 010101.
Step
4. Handle carry-over: a. If the outmost carry-over from step 3
is '1', discard it. b. If
the outmost carry-over from step 3 is '0', take the true complement of the
result in step 3 and prefix the negative sign.
The Radix-minus-one complement of 010101 is 101010. Then add 1
to 101010 to get the true complement.
Our answer is –
1010112.
Click
Here for Activity No 3!!!
Part 15. Binary Codes
Digital systems operate
using binary code, a system of 1s and 0s. However, humans interact with information
using decimal numbers. To bridge this gap, digital devices must convert data
between binary and a more human-readable format. This involves representing
each character (number, letter, or symbol) as a unique combination of 1s and
0s. This representation is called a code.
Part 15.1 Binary Coded Decimals (BCD) Codes
Arithmetic operations are
typically performed using decimal numbers. However, computers work with binary
numbers. Binary Coded Decimal (BCD) was developed to bridge this gap. BCD represents
each decimal digit as a four-bit binary equivalent. Numbers 0 to 9 correspond
to binary codes 0000 to 1001. Six combinations (1010 to 1111) remain unused.
BCD codes are categorized into weighted and unweighted types.
Example
No. 40
Convert 936 to BCD Code
Solution:
|
3rd Digit |
2nd Digit |
1st Digit |
|
9 |
3 |
6 |
Answer |
1001 |
0011 |
0110 |
Example
No. 41
Convert 7121 to BCD Code
Solution:
|
4th Digit |
3rd Digit |
2nd Digit |
1st Digit |
|
7 |
1 |
2 |
1 |
Answer |
0111 |
0001 |
0010 |
0001 |
Part 15.1.1 Weighted BCD Code
The most common weighted BCD code is the 8-4-2-1 code. In this
code, the digits in a binary number have weights of 8, 4, 2, and 1. The table
below shows several weighted BCD codes.
Decimal
Digit |
Natural
Binary 8-4-2-1 |
4-2-2-1 |
2-4-2-1 |
Biquianary |
|
||||
5-0 |
4-3-2-1-0 |
|
|||||||
0 |
0000 |
0000 |
0000 |
01 |
00001 |
||||
1 |
0001 |
0001 |
0001 |
01 |
00010 |
||||
2 |
0010 |
0010 |
0010 |
01 |
00100 |
||||
3 |
0011 |
0011 |
0110 |
01 |
01000 |
||||
4 |
0100 |
1000 |
0100 |
01 |
10000 |
||||
5 |
0101 |
0111 |
1011 |
01 |
00001 |
||||
6 |
0110 |
1100 |
1100 |
10 |
00010 |
||||
7 |
0111 |
1101 |
1101 |
10 |
00100 |
||||
8 |
1000 |
1110 |
1110 |
10 |
01000 |
||||
9 |
1001 |
1111 |
1111 |
10 |
10000 |
||||
Part 15.1.2 Unweighted BCD Code
Unweighted BCD codes are used in data processing,
transmission, and measurement, but not in arithmetic operations due to their lack
of positional weight. Examples include Excess-3 code, Gray code, and 2 out of 5
code. The table below shows these codes.
Decimal Digit |
Excess-3 Code |
Gray Code |
2 out of 5 |
0 |
0011 |
0000 |
00011 |
1 |
0100 |
0001 |
00101 |
2 |
0101 |
0011 |
00110 |
3 |
0110 |
0010 |
01001 |
4 |
0111 |
0110 |
01010 |
5 |
1000 |
0111 |
01100 |
6 |
1001 |
0101 |
10001 |
7 |
1010 |
0100 |
10010 |
8 |
1011 |
1100 |
10100 |
9 |
1100 |
1101 |
1100 |
Note:
Excess-3 code is always three greater than the same 8-4-2-1 representation.
Part 15.2 Character Codes
In addition to numbers, digital systems must handle text,
symbols, and other non-numeric information. To do this, they use character
codes that represent letters, punctuation marks, and special characters.
EBCDIC:
An 8-bit code used in IBM systems. It represents characters using two 4-bit
groups.
ASCII:
The most common character code. It's a 7-bit code divided into data link
control, graphic control, and alphanumeric characters. Used for data transfer
between computers and devices.
Baudot Code:
A 5-level code developed for teletype machines. Represents letters, numbers,
punctuation, and special symbols using a "lowercase" and
"uppercase" set.
Hollerith
Code: Used in punched cards. Each column represents a digit,
letter, or symbol. A 12-level code is used to represent data.
Part 15.3 Codes for Actions, Conditions, and States
These
codes use simple binary numbers to control actions, indicate conditions, or
represent the current state of hardware in a digital system.
Part 15.4 Codes for Detecting and Correcting Errors
When
transmitting binary data, errors can occur, leading to misinterpretation. To
address this, digital systems use error detection and correction methods.
Parity bits, checksum codes, CRC codes, and Hamming codes are examples of these
techniques.
Part 15.5 Codes for Data Transmission
Data
transmission is a common operation in digital systems. Information is
transmitted in binary form as voltage levels between sending and receiving
circuits. The format of the signal on the line during transmission is
determined by the line code. Manchester code and AMI are examples of line codes
used for data transmission.
Fun Fact!!! Emojis originated in
Japan in the 1990s as a way to add expressive elements to text messages. They
were initially limited to a small set of basic smiley faces and other symbols,
but have since expanded to include a wide variety of characters representing
emotions, objects, and people.
END of the LESSON